home *** CD-ROM | disk | FTP | other *** search
- Path: atlas.axiom.net!usenet
- From: Dave Nulton <dnult@axiom.net>
- Newsgroups: comp.lang.c++
- Subject: Re: How to make a Complex class
- Date: 1 Jan 1996 18:11:21 GMT
- Organization: Axiom Communications
- Message-ID: <4c984a$99t@atlas.axiom.net>
- References: <4c8kdm$p0q@news.csie.nctu.edu.tw>
- NNTP-Posting-Host: node094.axiom.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
-
- I've just been working with complex classes myself in C++. The
- class is in there. There is already a library installed in my
- compiler - use it by including <complex.h>. It defines a
- structure you use called complex. Define a number something like
- this.
-
- complex(double r, double i);
-
- As far as your format (typical mathmatical format) you'll have to
- format you output and parse you input to make it work properly.
-
- The advantage to the complex library is that most all of the math
- functions and stream operators have been overloaded to handle the
- complex math. In addition there are several standard functions.
- The only thing not included is polar operators, but those are easy
- to construct.
-
- Hope that helps
- -dnult
-
-